package com.bole.dao;

import com.bole.pojo.TbCarDo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

@Transactional
public interface CarDao extends JpaRepository<TbCarDo, Long> {
    List<TbCarDo> findAllByBrandId(Long brandId);

    @Query(value = "SELECT*FROM tb_car where status=1 limit 6",nativeQuery = true)
    List<TbCarDo> findAllByStatus();
    @Query(value = "from TbCarDo where id = ?1")
    TbCarDo findCarById(Long carId);
}
